home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 126-150 / disk_146 / dmemacros / better.readme < prev    next >
Text File  |  1992-05-06  |  9KB  |  171 lines

  1.    A couple of years ago, I saw a language-sensitive editor on a Sun
  2. workstation which utilized source-code templates and input `gadgets' (or
  3. Sun's analogue of them) to greatly simplify the task of writing code.  I
  4. have searched for over a year now in hopes of finding an editor for the
  5. Amiga which could offer me similar power: I finally found one.
  6.  
  7.    The newest version of Matt Dillon's editor, DME (FF #134), offers
  8. enough power in its macro language to emulate the code-entry features of
  9. professional-quality, language-sensitive editors.  I have written several
  10. dozen DME macros which create source-code templates (e.g., if-else blocks,
  11. case structures, etc.) in four languages: C, Pascal, Modula-2 and Fortran.
  12. By typing one key (or key-combination) and entering the desired variable-
  13. name or conditional-expression, the macro will type the necessary keywords
  14. and punctuation to complete the template.  Indentation is preserved, blank
  15. lines are used to separate templates, and comments are printed where
  16. feasible. The macros are easily (?) alterable to your standards of white-
  17. space allocation and comment-inclusion, and they execute with great speed.
  18.  
  19.    Because these macros are stored in individual files, they must be
  20. sourced each time the desired template is to be written into the source-
  21. code file.  Thus, it is best to store the files in a ram-disk; whatever
  22. keys you use to invoke the templates should source the files in the
  23. ram-disk for fast execution.  While it would be nice to avoid having to
  24. store extra files in a ram-disk, most of these macros are longer than the
  25. 255 characters allowed in a single line of a macro file (except for the
  26. Fortran macros, which could probably all be put into individual macros and
  27. sourced when the editor is brought up).  Even so, the speed at which the
  28. macros write to the screen is pleasantly swift (this from a competent
  29. touch-typist with a short temper).
  30.  
  31.    To try out the demos, do the following: run the Initiator in the
  32. InitializeDemos directory (copies necessary files to ram:); launch the
  33. template files in each of the language subdirectories in the DME_macros
  34. directory; when finished trying-out the macros, run the Terminator in the
  35. TerminalizeDemos directory (deletes files created by the Initiator).
  36.  
  37.    Before running the Initiator, (or the Terminator) be certain that the
  38. following commands are in your c: directory and are immediately accessible:
  39. COPY, DELETE, ASSIGN and MAKEDIR. The Initiator (and Terminator) need these
  40. commands to create and destroy the directories and files required by the
  41. templates.
  42.  
  43.    The Initiator, the Terminator and the template files are actually docu-
  44. ment files used to launch DME.    These files are kept in separate subdirec-
  45. tories so that DME will source the (unique) .edrc files in those subdirec-
  46. tories.  Though the .info files for each of the document icons supports
  47. argument-passing via the ToolTypes, you can't specify the macro file to
  48. source on startup.  I have tried this several times with both the DME .info
  49. file and the .info files for the documents; while the window-resizing tools
  50. are handled properly, the macro-file option is apparently ignored.
  51.  
  52.    Once you `edit' (launch) the template file in a language subdirectory,
  53. you will find that the keys on the numeric keypad have been mapped to the
  54. macros available for that language.  If you press one of those keys, you
  55. will see a skeleton of the template appear (there are a couple of excep-
  56. tions) and the editor will (usually) enter command-entry mode with an
  57. initial prompt of either a left single-quote or else a left single-quote
  58. followed by a space.  You should type in the variable name or conditional
  59. expression appropriate for the template, followed by a right single-quote
  60. or else a space and then a right single-quote if the initial prompt
  61. contained a left single-quote followed by a space.  If you have any trou-
  62. ble, just read the text in the template file for explanations and examples.
  63.  
  64.    If my keymap preferences are confusing to you, just click the close box
  65. in the edit window (you may have to do it twice if the file has been
  66. modified).  The keymap definitions are contained in the .edrc file in the
  67. OtherMacros subdirectory (accessible via the CLI); the file .edrc.commented
  68. explains the definitions briefly.  The Initiator copies .edrc into the
  69. directory ram:MD, and it is the ram-based copy which is sourced by each of
  70. the language templates.  By changing these keydefs, or replacing the file
  71. with your own .edrc file, you can change the editing environment to one more
  72. familiar.
  73.  
  74.    Finally, in case it isn't immediately obvious, these macros are in the
  75. public domain.    I claim no rights to any of the macros, which means that
  76. you may butcher them to your heart's desire.  Happy hacking!
  77.  
  78.  
  79.                           Jerry Mack
  80.  
  81.             NEW (temporary) ADDRESS:  8912 North Lamar Blvd.
  82.                           Apt. 237
  83.                           Austin, TX   78753
  84.  
  85.  
  86.    P.S.  Peruse my .edrc file for some neat extras: Mac-like selection,
  87.      copying and deletion of text blocks using the mouse (I use two
  88.      clipboards, but you can use more); TRUE delete and backspace
  89.      macros and TRUE forward- and backward-word-delete macros (be sure
  90.      to put the join.edrc macro in a ram-disk and change the path name
  91.      in the source command in my .edrc file); search and replace macros
  92.      which allow replacing words anywhere under the cursor (allowing
  93.      you to search a file with the FIND command and selectively replace
  94.      strings without having to explicitly reposition the cursor and
  95.      execute a FINDR); macros for shifting and deleting columns of text
  96.      within a block; and a logical mapping of various scrolling and
  97.      file-repositioning commands to the cursor keys and the nearby
  98.      shift- and alt-keys.
  99.  
  100.  P.P.S.  I know my backspace and delete macros seem confusing; however, I
  101.      strived over two days to make them short enough to execute quickly
  102.      while still handling ALL the (known) cases in which the JOIN
  103.      command doesn't behave properly.  Everything in the macros is
  104.      essential; if you don't like the way it's written, just use it and
  105.      forget that it's there.  By the way, here are some of the problems
  106.      you'll have to contend with when using JOIN in you macros:
  107.  
  108.         a) JOIN eats all blank characters to the left of the first
  109.            printable character in the line below the cursor;
  110.         b) JOIN eats all blank characters (but one) to the right of
  111.            the last printable character in the line containing the
  112.            cursor;
  113.         c) if you explicitly print blanks at the end of the current
  114.            line to replace those eaten in a) above (as I did), you must
  115.            check whether the cursor is one or more than one column to
  116.            the right of the last printable character in the current
  117.            line (it behaves differently in the two cases);
  118.         d) if the line below the cursor is the last line of the
  119.            file, JOIN mistakenly puts the cursor on the penultimate
  120.            line when it has completed the join, unless
  121.         e) there are only two lines in a file, in which case the JOIN
  122.            command will exit with an error (since it can' t mistakenly
  123.            place the cursor on the penultimate line) meaning the
  124.            remainder of any macro containing the JOIN command will be
  125.            ignored and the macro execution will be terminated;
  126.         f) several others which I managed to purge from my long-term
  127.            memory (good riddance!).
  128.  
  129.      There are occasional side-effects when using the delete and back-
  130.      space keys with wordwrap enabled.  Also, do not try to join
  131.      together lines with a combined length greater than 250 characters,
  132.      unless you don't mind the macro eating parts of your file.
  133.  
  134.  
  135.  BEWARE: There is a bug with the ESCIMM command which requires that it
  136.      be in the last line of a macro file.  If there are any lines in
  137.      the macro file subsequent to the line containing the ESCIMM
  138.      command, then the text in the subsequent lines is written to the
  139.      command line (it leaves a big mess).  You may include multiple,
  140.      explicit ESCIMM commands in the last line, but you may not include
  141.      the ESCIMM command within loops (they don't execute at all,
  142.      apparently).
  143.  
  144.  
  145.  Things Which Would Have Made This a Lot Simpler (not that I'm complain-
  146.  ing, Matt):
  147.  
  148.      1) String variables - using $scanf is awkward and extremely
  149.         limited;
  150.      2) Integer variables (and arithmetic) - would have been very
  151.         useful for and   loops;
  152.      3) ability to extend if blocks across multiple lines for
  153.         legibility (I probably won't get this one...);
  154.      4) multiple test-conditions in loops and if blocks;
  155.      5) don't specify the disk name in the default tool of the .info
  156.         file - it prevents sourcing of the .edrc file in the subdirec-
  157.         tory in which the text file is located (a colon is sufficient);
  158.      6) ability to specify default script-file in tooltypes of text-
  159.         file's .info file;
  160.      7) a replace (not find-and-replace) command - for searching through
  161.         a file and replacing selective occurrences of a string;
  162.      8) force scanf to halt when it processes a blank - e.g., if you
  163.         specify %[~,] for the control-string, scanf will process the
  164.         entire line if it doesn't contain a comma; alternatively, allow
  165.         the specification of a blank in the control string (e.g. %[~ ]),
  166.         as this gets around the above limitation while maintaining com-
  167.         patibility with macros others will have written by now;
  168.      9) allow ESCIMM to be used in multiple lines in a macro file as
  169.         well as within loops;
  170.     10) fewer bugs.
  171.